﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DiscoveryLogic.BusinessLogic;
using Microsoft.Practices.Composite.Events;

namespace DiscoveryLogic.XamlParts.Views
{
	public class SolutionPresenter
	{
		private ISolutionTreeViewPresenter solutionPresenter;
		private ISolutionController solutionController;

		public SolutionPresenter(
            ISolutionView view,
			ISolutionTreeViewPresenter slnPresenter,
			ISolutionController slnController)
        {
            this.View = view;
			this.solutionPresenter = slnPresenter;
			this.solutionPresenter.SolutionSelected += new EventHandler<DataEventArgs<Solution>>(this.OnSolutionSelected);
			this.solutionController = slnController;

            View.SetHeader(slnPresenter.View);
        }

		public ISolutionView View { get; set; }

		private void OnSolutionSelected(object sender, DataEventArgs<Solution> e)
        {
			solutionController.OnSolutionSelected(e.Value);
        }
	}
}
